package org.ww.search.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.ww.search.service.MallSearchService;
import org.ww.search.vo.SearchParam;
import org.ww.search.vo.SearchResult;

/**
 * @program: gmall
 * @description: searchController
 * @author: ww
 * @create: 2024-04-16 11:37
 **/
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String list(SearchParam searchParam, Model model){
        SearchResult result = mallSearchService.search(searchParam);
        model.addAttribute("result",result);
        return "list";
    }

}
